fix(libra): clone remote repo gets error, remote reference names in db are wrong.#1385
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…e names in db are wrong. Signed-off-by: l00626685 <5110214+lifan-ake@users.noreply.github.com>
Signed-off-by: l00626685 <5110214+lifan-ake@users.noreply.github.com>
…ing to Clippy Signed-off-by: l00626685 <5110214+lifan-ake@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This PR fixes an issue where remote branch references were being stored incorrectly in the libra.db during clone operations. The fix ensures that remote branch names are stored without the refs/remote/origin prefix and the remote column is properly set to "origin".
- Removes the
refs/remotes/{remote_name}/prefix from remote branch names when storing in the database - Updates function calls to pass remote information correctly throughout the clone and fetch operations
- Adds
Clonederive trait toRemoteConfigstruct to support passing by value
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| libra/src/internal/config.rs | Adds Clone trait to RemoteConfig struct |
| libra/src/command/fetch.rs | Updates branch name storage to remove remote prefix and properly handle remote parameter |
| libra/src/command/clone.rs | Refactors to pass RemoteConfig instead of string and updates all remote configuration calls |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| full_ref_name = | ||
| format!("refs/remotes/{}/mr/{}", remote_config.name, mr_name); | ||
| full_ref_name = format!("mr/{}", mr_name); | ||
| } else if r._ref == HEAD { |
There was a problem hiding this comment.
The comparison r._ref == HEAD will fail because HEAD is imported as a constant but r._ref is likely a string literal "HEAD". This should be r._ref == "HEAD" or ensure HEAD constant matches the expected string value.
| } else if r._ref == HEAD { | |
| } else if r._ref == "HEAD" { |
Should close #1384
Description
After getting remote refs from remote repo, remote branch names saved in the libra.db should not include the prefix
refs/remote/originand theremotecolumn should be origin.